<?php
/**
 * Manage/track webmaster data in NATS3 affiliate tracking system database
 * 
 * @name		track/edit affiliate info
 * @version		1.0
 * @package		nats-space
 * @see			http://code.google.com/p/nats-space/
 * @copyright	2009
 * @author		Joseph C. <joseph.cheys@gmail.com>
 */
class Nats3space_Affiliates {
	/**
	 * @var Zend_Db_Adapter_Mysql
	 */
	private $_db;
	
	/**
	 * assigns MySQL connection adapter instance
	 * 
	 * @param $db database adapter
	 * @return
	 */
	public function __construct(Zend_Db_Adapter_Abstract $db) {
		$this->_db = $db;
	}
	
	/**
	 * Checks either webmaster login registered or not
	 * 
	 * @param $login webmaster login to check
	 * @return boolean returns true is exists or false otherwise
	 */
	public function isRegisterred($login) {
		$sql = '
            SELECT 
                *
            FROM 
                accounts 
            WHERE 
                username = ?';
		
		$result = $this->_db->fetchRow ( $sql, $login );
		
		if (! empty ( $result ) && is_array ( $result )) {
			return true;
		}
		
		return false;
	}
}